﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;
using DataAccessClasses;

namespace eschoolBO
{
    public class report
    {
        iDAC DAC = DACFactory.GetDAC();
        private long _report_id = -99;
        private string _examination = "";
        private long _class_id = -99;
        private long _student_id = -99;
        private long _subject_id = -99;
        private int _max_theorymarks = -99;
        private int _max_practicalmarks = -99;
        private int _max_projectmarks = -99;
        private int _obt_theorymarks = -99;
        private int _obt_practicalmarks = -99;
        private int _obt_projectmarks = -99;
        private int _total_maxmarks = -99;
        private int _total_obtmarks = -99;
        private decimal _percentage = -99;
        private string _grade = "";
        private long _remark_id = -99;
        private bool _isdeleted = false;
        public long report_id
        {
            get
            {
                return _report_id;
            }
            set
            {
                _report_id = value;
            }
        }
        public string examination
        {
            get
            {
                return _examination;
            }
            set
            {
                _examination = value;
            }
        }

        public long class_id
        {
            get
            {
                return _class_id;
            }
            set
            {
                _class_id = value;
            }
        }

        public long student_id
        {
            get
            {
                return _student_id;
            }
            set
            {
                _student_id = value;
            }
        }

        public long subject_id
        {
            get
            {
                return _subject_id;
            }
            set
            {
                _subject_id = value;
            }
        }
        public int max_theorymarks
        {
            get
            {
                return _max_theorymarks;
            }
            set
            {
                _max_theorymarks = value;
            }
        }
        public int max_practicalmarks
        {
            get
            {
                return _max_practicalmarks;
            }
            set
            {
                _max_practicalmarks = value;
            }
        }
        public int max_projectmarks
        {
            get
            {
                return _max_projectmarks;
            }
            set
            {
                _max_projectmarks = value;
            }
        }
        public int obt_theorymarks
        {
            get
            {
                return _obt_theorymarks;
            }
            set
            {
                _obt_theorymarks = value;
            }
        }
        public int obt_practicalmarks
        {
            get
            {
                return _obt_practicalmarks;
            }
            set
            {
                _obt_practicalmarks = value;
            }
        }
        public int obt_projectmarks
        {
            get
            {
                return _obt_projectmarks;
            }
            set
            {
                _obt_projectmarks = value;
            }
        }
        public int total_maxmarks
        {
            get
            {
                return _total_maxmarks;
            }
            set
            {
                _total_maxmarks = value;
            }
        }
        public int total_obtmarks
        {
            get
            {
                return _total_obtmarks;
            }
            set
            {
                _total_obtmarks = value;
            }
        }
        public decimal percentage
        {
            get
            {
                return _percentage;
            }
            set
            {
                _percentage = value;
            }
        }
        public string grade
        {
            get
            {
                return _grade;
            }
            set
            {
                _grade = value;
            }
        }
        public long remark_id
        {
            get
            {
                return _remark_id;
            }
            set
            {
                _remark_id = value;
            }
        }
        public bool isdeleted
        {
            get
            {
                return _isdeleted;
            }
            set
            {
                _isdeleted = value;
            }
        }
        public long SaveRecords()
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@report_id", report_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@examination", examination, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@class_id", class_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@student_id", student_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@subject_id", subject_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@max_theorymarks", max_theorymarks, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam6 = DAC.Parameter("@max_practicalmarks", max_practicalmarks, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam7 = DAC.Parameter("@max_projectmarks", max_projectmarks, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam8 = DAC.Parameter("@obt_theorymarks", obt_theorymarks, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam9 = DAC.Parameter("@obt_practicalmarks", obt_practicalmarks, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam10 = DAC.Parameter("@obt_projectmarks", obt_projectmarks, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam11 = DAC.Parameter("@total_maxmarks", total_maxmarks, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam12 = DAC.Parameter("@total_obtmarks", total_obtmarks, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam13 = DAC.Parameter("@percentage", percentage, DbType.Decimal, ParameterDirection.Input);
                DbParameter dbparam14 = DAC.Parameter("@grade", grade, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam15 = DAC.Parameter("@remark_id", remark_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam16 = DAC.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6, dbparam7, dbparam8, dbparam9, dbparam10, dbparam11, dbparam12, dbparam13, dbparam14, dbparam15, dbparam16 };
                return DAC.Save("report_save", dbparamcall);
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return -99;
        }
        public DataTable GetRecords(long report_id, string examination, long class_id, long student_id,long subject_id,
         int max_theorymarks,int max_practicalmarks,int max_projectmarks,int obt_theorymarks,int obt_practicalmarks,
         int obt_projectmarks,int total_maxmarks,int total_obtmarks,float percentage,string grade,long remark_id,
         bool isdeleted, string paraandor)
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@report_id", report_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@examination", examination, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@class_id", class_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@student_id", student_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@subject_id", subject_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@max_theorymarks", max_theorymarks, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam6 = DAC.Parameter("@max_practicalmarks", max_practicalmarks, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam7 = DAC.Parameter("@max_projectmarks", max_projectmarks, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam8 = DAC.Parameter("@obt_theorymarks", obt_theorymarks, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam9 = DAC.Parameter("@obt_practicalmarks", obt_practicalmarks, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam10 = DAC.Parameter("@obt_projectmarks", obt_projectmarks, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam11 = DAC.Parameter("@total_maxmarks", total_maxmarks, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam12 = DAC.Parameter("@total_obtmarks", total_obtmarks, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam13 = DAC.Parameter("@percentage", percentage, DbType.Decimal, ParameterDirection.Input);
                DbParameter dbparam14 = DAC.Parameter("@grade", grade, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam15 = DAC.Parameter("@remark_id", remark_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam16 = DAC.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam17 = DAC.Parameter("@paraandor", paraandor, DbType.AnsiString, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6, dbparam7, dbparam8, dbparam9, dbparam10, dbparam11, dbparam12, dbparam13, dbparam14, dbparam15, dbparam16, dbparam17 };
                DataTable dt1 = DAC.Select("report_get", dbparamcall);
                return dt1;
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return null;
        }
    }
}